/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * InscribirEstudiante.java
 *
 * Created on 17/02/2011, 11:41:35 AM
 */

package Pantallas;

import Clases.Estudiante;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

/**
 *
 * @author Reinaldo Carvallo
 */
public class InscribirEstudiante extends javax.swing.JFrame {
    int [] notas_parciales= new int [4];
      Estudiante e1 ;
    /** Creates new form InscribirEstudiante */
    public InscribirEstudiante() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtCedula = new javax.swing.JTextField();
        txtNombAp = new javax.swing.JTextField();
        btnAgregar = new javax.swing.JButton();
        btnSalir = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(null);

        jLabel1.setText("Inscribir Estudiante");
        getContentPane().add(jLabel1);
        jLabel1.setBounds(190, 30, 110, 14);

        jLabel2.setText("Cedula");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(120, 110, 70, 14);

        jLabel3.setText("Nombre y apellido");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(70, 150, 110, 14);
        getContentPane().add(txtCedula);
        txtCedula.setBounds(210, 110, 150, 19);
        getContentPane().add(txtNombAp);
        txtNombAp.setBounds(210, 150, 240, 19);

        btnAgregar.setText("Agregar");
        btnAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarActionPerformed(evt);
            }
        });
        getContentPane().add(btnAgregar);
        btnAgregar.setBounds(90, 250, 120, 23);

        btnSalir.setText("Salir");
        btnSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalirActionPerformed(evt);
            }
        });
        getContentPane().add(btnSalir);
        btnSalir.setBounds(270, 250, 120, 23);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-500)/2, (screenSize.height-360)/2, 500, 360);
    }// </editor-fold>//GEN-END:initComponents

    private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed

        // TODO add your handling code here:
        if (txtCedula.getText().equals("")|| txtNombAp.getText().equals(""))
        {
       JOptionPane.showMessageDialog(new JFrame(),"Debe Introducir Todos los Datos","Aviso",JOptionPane.CANCEL_OPTION);
        }
            else{
             e1= new Estudiante(txtCedula.getText(), txtNombAp.getText(), 0, notas_parciales, "");
                MenuPrincipal.s1.AgregarEstudiantes(e1);
                MenuPrincipal.s1.ordenar(MenuPrincipal.e1);
                txtCedula.setText("");
                txtNombAp.setText("");
               // MenuPrincipal.s1.imprimir(MenuPrincipal.e1,p1);
                JOptionPane.showMessageDialog(new JFrame(),"Estudiante Inscrito Exitosamente","Aviso",JOptionPane.CANCEL_OPTION);
            }
        




    }//GEN-LAST:event_btnAgregarActionPerformed

    private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirActionPerformed
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_btnSalirActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new InscribirEstudiante().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAgregar;
    private javax.swing.JButton btnSalir;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JTextField txtCedula;
    private javax.swing.JTextField txtNombAp;
    // End of variables declaration//GEN-END:variables

}
